#pragma once

template <typename T, typename Base>
class DSingleton
{
    static boost::shared_ptr<T> m_inst;
public:
    static boost::shared_ptr<Base> instance();
};

template <typename T, typename Base>
boost::shared_ptr<T> DSingleton<T, Base>::m_inst;

template <typename T, typename Base>
boost::shared_ptr<Base> DSingleton<T, Base>::instance()
{
    if(!m_inst)
    {
        m_inst = boost::shared_ptr<T>(new T);
    }

    return m_inst;
}